﻿namespace HiMap.MapControls
{
    using HiMap.Style;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class StyleControl : UserControl
    {
        private ComboBox cmbLineWidth;
        private IContainer components;
        private StyleType ControlStyle;
        private ImageList img;
        private Label labLineColor;
        private Label labLineWidth;
        private ListView listColor;
        private Panel panFull;
        private Panel panLine;
        private Panel panLineColor;
        private Panel panLineColorBlue;
        private Panel panLineColorLime;
        private Panel panLineColorRed;
        private Panel panMain;
        private Panel panMainBlue;
        private Panel panMainLime;
        private Panel panMainRed;
        private Panel panTop;
        private PictureBox picLine;
        private PictureBox picLineBlue;
        private PictureBox picLineLime;
        private PictureBox picLineRed;
        private PictureBox picMain;
        private PictureBox picMainBlue;
        private PictureBox picMainLime;
        private PictureBox picMainRed;
        private IPolylineStyle pls;
        private IPolygonStyle pns;
        private IPointStyle ps;
        private Random r;
        private TrackBar trkLineBlue;
        private TrackBar trkLineLime;
        private TrackBar trkLineRed;
        private TrackBar trkMainBlue;
        private TrackBar trkMainLime;
        private TrackBar trkMainRed;
        private TextBox txtLineBlue;
        private TextBox txtLineLime;
        private TextBox txtLineRed;
        private TextBox txtMainBlue;
        private TextBox txtMainLime;
        private TextBox txtMainRed;

        public StyleControl()
        {
            this.InitializeComponent();
            this.r = new Random();
            this.setTxtEvent();
            this.setTrkEvent();
            this.getText();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private Color GetColor()
        {
            Color color = Color.FromArgb(this.r.Next());
            Bitmap bitmap = new Bitmap(this.img.ImageSize.Width, this.img.ImageSize.Height);
            for (int i = 0; i < bitmap.Width; i++)
            {
                for (int j = 0; j < bitmap.Height; j++)
                {
                    bitmap.SetPixel(i, j, color);
                }
            }
            this.img.Images.Add(Image.FromHbitmap(bitmap.GetHbitmap()));
            return color;
        }

        private void getText()
        {
            this.labLineWidth.Text = Setup.GetInfo("StyleControllabLineWidth");
            this.labLineColor.Text = Setup.GetInfo("StyleControllabLineColor");
        }

        private void IniControl()
        {
            switch (this.ControlStyle)
            {
                case StyleType.PointStyle:
                    this.panTop.Visible = true;
                    this.panLine.Visible = false;
                    return;

                case StyleType.PolylineStyle:
                    this.panTop.Visible = false;
                    this.panLine.Visible = true;
                    return;

                case StyleType.PolygonStyle:
                    this.panTop.Visible = true;
                    this.panLine.Visible = true;
                    return;
            }
        }

        private void InitializeComponent()
        {
            this.panMain = new Panel();
            this.panFull = new Panel();
            this.listColor = new ListView();
            this.img = new ImageList();
            this.panLine = new Panel();
            this.picLine = new PictureBox();
            this.panLineColor = new Panel();
            this.panLineColorBlue = new Panel();
            this.trkLineBlue = new TrackBar();
            this.txtLineBlue = new TextBox();
            this.picLineBlue = new PictureBox();
            this.panLineColorLime = new Panel();
            this.trkLineLime = new TrackBar();
            this.txtLineLime = new TextBox();
            this.picLineLime = new PictureBox();
            this.panLineColorRed = new Panel();
            this.trkLineRed = new TrackBar();
            this.txtLineRed = new TextBox();
            this.picLineRed = new PictureBox();
            this.labLineColor = new Label();
            this.cmbLineWidth = new ComboBox();
            this.labLineWidth = new Label();
            this.panTop = new Panel();
            this.panMainBlue = new Panel();
            this.trkMainBlue = new TrackBar();
            this.txtMainBlue = new TextBox();
            this.picMainBlue = new PictureBox();
            this.panMainLime = new Panel();
            this.trkMainLime = new TrackBar();
            this.txtMainLime = new TextBox();
            this.picMainLime = new PictureBox();
            this.panMainRed = new Panel();
            this.trkMainRed = new TrackBar();
            this.txtMainRed = new TextBox();
            this.picMainRed = new PictureBox();
            this.picMain = new PictureBox();
            this.panMain.SuspendLayout();
            this.panFull.SuspendLayout();
            this.panLine.SuspendLayout();
            this.panLineColor.SuspendLayout();
            this.panLineColorBlue.SuspendLayout();
            this.panLineColorLime.SuspendLayout();
            this.panLineColorRed.SuspendLayout();
            this.panTop.SuspendLayout();
            this.panMainBlue.SuspendLayout();
            this.panMainLime.SuspendLayout();
            this.panMainRed.SuspendLayout();
            base.SuspendLayout();
            this.panMain.Controls.Add(this.panFull);
            this.panMain.Controls.Add(this.panTop);
            this.panMain.Dock = DockStyle.Fill;
            this.panMain.Location = new Point(0, 0);
            this.panMain.Name = "panMain";
            this.panMain.Size = new Size(0xc5, 0xc5);
            this.panFull.Controls.Add(this.listColor);
            this.panFull.Controls.Add(this.panLine);
            this.panFull.Dock = DockStyle.Fill;
            this.panFull.Location = new Point(0, 0x3f);
            this.panFull.Name = "panFull";
            this.panFull.Size = new Size(0xc5, 0x86);
            this.listColor.Dock = DockStyle.Fill;
            this.listColor.Font = new Font("Tahoma", 8f, FontStyle.Regular);
            this.listColor.LargeImageList = this.img;
            this.listColor.Location = new Point(0, 0);
            this.listColor.Name = "listColor";
            this.listColor.Size = new Size(0x54, 0x86);
            this.listColor.SmallImageList = this.img;
            this.listColor.TabIndex = 1;
            this.listColor.View = View.SmallIcon;
            this.listColor.SelectedIndexChanged += new EventHandler(this.listColor_SelectedIndexChanged);
            this.img.ImageSize = new Size(20, 20);
            this.panLine.Controls.Add(this.picLine);
            this.panLine.Controls.Add(this.panLineColor);
            this.panLine.Controls.Add(this.labLineColor);
            this.panLine.Controls.Add(this.cmbLineWidth);
            this.panLine.Controls.Add(this.labLineWidth);
            this.panLine.Dock = DockStyle.Right;
            this.panLine.Location = new Point(0x54, 0);
            this.panLine.Name = "panLine";
            this.panLine.Size = new Size(0x71, 0x86);
            this.picLine.Dock = DockStyle.Top;
            this.picLine.Location = new Point(0, 0x76);
            this.picLine.Name = "picLine";
            this.picLine.Size = new Size(0x71, 0x11);
            this.panLineColor.Controls.Add(this.panLineColorBlue);
            this.panLineColor.Controls.Add(this.panLineColorLime);
            this.panLineColor.Controls.Add(this.panLineColorRed);
            this.panLineColor.Dock = DockStyle.Top;
            this.panLineColor.Location = new Point(0, 0x36);
            this.panLineColor.Name = "panLineColor";
            this.panLineColor.Size = new Size(0x71, 0x40);
            this.panLineColorBlue.Controls.Add(this.trkLineBlue);
            this.panLineColorBlue.Controls.Add(this.txtLineBlue);
            this.panLineColorBlue.Controls.Add(this.picLineBlue);
            this.panLineColorBlue.Dock = DockStyle.Top;
            this.panLineColorBlue.Location = new Point(0, 0x2a);
            this.panLineColorBlue.Name = "panLineColorBlue";
            this.panLineColorBlue.Size = new Size(0x71, 0x15);
            this.trkLineBlue.Dock = DockStyle.Top;
            this.trkLineBlue.Location = new Point(0x15, 0);
            this.trkLineBlue.Maximum = 0xff;
            this.trkLineBlue.Name = "trkLineBlue";
            this.trkLineBlue.Size = new Size(0x3e, 0x13);
            this.trkLineBlue.TabIndex = 10;
            this.txtLineBlue.Dock = DockStyle.Right;
            this.txtLineBlue.Location = new Point(0x53, 0);
            this.txtLineBlue.MaxLength = 3;
            this.txtLineBlue.Name = "txtLineBlue";
            this.txtLineBlue.Size = new Size(30, 0x15);
            this.txtLineBlue.TabIndex = 1;
            this.picLineBlue.BackColor = Color.Blue;
            this.picLineBlue.Dock = DockStyle.Left;
            this.picLineBlue.Location = new Point(0, 0);
            this.picLineBlue.Name = "picLineBlue";
            this.picLineBlue.Size = new Size(0x15, 0x15);
            this.panLineColorLime.Controls.Add(this.trkLineLime);
            this.panLineColorLime.Controls.Add(this.txtLineLime);
            this.panLineColorLime.Controls.Add(this.picLineLime);
            this.panLineColorLime.Dock = DockStyle.Top;
            this.panLineColorLime.Location = new Point(0, 0x15);
            this.panLineColorLime.Name = "panLineColorLime";
            this.panLineColorLime.Size = new Size(0x71, 0x15);
            this.trkLineLime.Dock = DockStyle.Top;
            this.trkLineLime.Location = new Point(0x15, 0);
            this.trkLineLime.Maximum = 0xff;
            this.trkLineLime.Name = "trkLineLime";
            this.trkLineLime.Size = new Size(0x3e, 0x13);
            this.trkLineLime.TabIndex = 10;
            this.txtLineLime.Dock = DockStyle.Right;
            this.txtLineLime.Location = new Point(0x53, 0);
            this.txtLineLime.MaxLength = 3;
            this.txtLineLime.Name = "txtLineLime";
            this.txtLineLime.Size = new Size(30, 0x15);
            this.txtLineLime.TabIndex = 1;
            this.picLineLime.BackColor = Color.Lime;
            this.picLineLime.Dock = DockStyle.Left;
            this.picLineLime.Location = new Point(0, 0);
            this.picLineLime.Name = "picLineLime";
            this.picLineLime.Size = new Size(0x15, 0x15);
            this.panLineColorRed.Controls.Add(this.trkLineRed);
            this.panLineColorRed.Controls.Add(this.txtLineRed);
            this.panLineColorRed.Controls.Add(this.picLineRed);
            this.panLineColorRed.Dock = DockStyle.Top;
            this.panLineColorRed.Location = new Point(0, 0);
            this.panLineColorRed.Name = "panLineColorRed";
            this.panLineColorRed.Size = new Size(0x71, 0x15);
            this.trkLineRed.Dock = DockStyle.Top;
            this.trkLineRed.Location = new Point(0x15, 0);
            this.trkLineRed.Maximum = 0xff;
            this.trkLineRed.Name = "trkLineRed";
            this.trkLineRed.Size = new Size(0x3e, 0x13);
            this.trkLineRed.TabIndex = 10;
            this.txtLineRed.Dock = DockStyle.Right;
            this.txtLineRed.Location = new Point(0x53, 0);
            this.txtLineRed.MaxLength = 3;
            this.txtLineRed.Name = "txtLineRed";
            this.txtLineRed.Size = new Size(30, 0x15);
            this.txtLineRed.TabIndex = 1;
            this.picLineRed.BackColor = Color.Red;
            this.picLineRed.Dock = DockStyle.Left;
            this.picLineRed.Location = new Point(0, 0);
            this.picLineRed.Name = "picLineRed";
            this.picLineRed.Size = new Size(0x15, 0x15);
            this.labLineColor.Dock = DockStyle.Top;
            this.labLineColor.Location = new Point(0, 0x26);
            this.labLineColor.Name = "labLineColor";
            this.labLineColor.Size = new Size(0x71, 0x10);
            this.labLineColor.TextAlign = ContentAlignment.TopCenter;
            this.cmbLineWidth.Dock = DockStyle.Top;
            this.cmbLineWidth.Items.Add("1");
            this.cmbLineWidth.Items.Add("2");
            this.cmbLineWidth.Items.Add("3");
            this.cmbLineWidth.Items.Add("4");
            this.cmbLineWidth.Items.Add("5");
            this.cmbLineWidth.Items.Add("6");
            this.cmbLineWidth.Items.Add("7");
            this.cmbLineWidth.Items.Add("8");
            this.cmbLineWidth.Items.Add("9");
            this.cmbLineWidth.Items.Add("10");
            this.cmbLineWidth.Location = new Point(0, 0x10);
            this.cmbLineWidth.Name = "cmbLineWidth";
            this.cmbLineWidth.Size = new Size(0x71, 0x16);
            this.cmbLineWidth.TabIndex = 1;
            this.labLineWidth.Dock = DockStyle.Top;
            this.labLineWidth.Location = new Point(0, 0);
            this.labLineWidth.Name = "labLineWidth";
            this.labLineWidth.Size = new Size(0x71, 0x10);
            this.labLineWidth.TextAlign = ContentAlignment.TopCenter;
            this.panTop.Controls.Add(this.panMainBlue);
            this.panTop.Controls.Add(this.panMainLime);
            this.panTop.Controls.Add(this.panMainRed);
            this.panTop.Controls.Add(this.picMain);
            this.panTop.Dock = DockStyle.Top;
            this.panTop.Location = new Point(0, 0);
            this.panTop.Name = "panTop";
            this.panTop.Size = new Size(0xc5, 0x3f);
            this.panMainBlue.Controls.Add(this.trkMainBlue);
            this.panMainBlue.Controls.Add(this.txtMainBlue);
            this.panMainBlue.Controls.Add(this.picMainBlue);
            this.panMainBlue.Dock = DockStyle.Top;
            this.panMainBlue.Location = new Point(0x3f, 0x2a);
            this.panMainBlue.Name = "panMainBlue";
            this.panMainBlue.Size = new Size(0x86, 0x15);
            this.trkMainBlue.Dock = DockStyle.Top;
            this.trkMainBlue.Location = new Point(0x15, 0);
            this.trkMainBlue.Maximum = 0xff;
            this.trkMainBlue.Name = "trkMainBlue";
            this.trkMainBlue.Size = new Size(0x53, 0x13);
            this.trkMainBlue.TabIndex = 0x10;
            this.txtMainBlue.Dock = DockStyle.Right;
            this.txtMainBlue.Location = new Point(0x68, 0);
            this.txtMainBlue.MaxLength = 3;
            this.txtMainBlue.Name = "txtMainBlue";
            this.txtMainBlue.Size = new Size(30, 0x15);
            this.txtMainBlue.TabIndex = 15;
            this.picMainBlue.BackColor = Color.Blue;
            this.picMainBlue.Dock = DockStyle.Left;
            this.picMainBlue.Location = new Point(0, 0);
            this.picMainBlue.Name = "picMainBlue";
            this.picMainBlue.Size = new Size(0x15, 0x15);
            this.panMainLime.Controls.Add(this.trkMainLime);
            this.panMainLime.Controls.Add(this.txtMainLime);
            this.panMainLime.Controls.Add(this.picMainLime);
            this.panMainLime.Dock = DockStyle.Top;
            this.panMainLime.Location = new Point(0x3f, 0x15);
            this.panMainLime.Name = "panMainLime";
            this.panMainLime.Size = new Size(0x86, 0x15);
            this.trkMainLime.Dock = DockStyle.Top;
            this.trkMainLime.Location = new Point(0x15, 0);
            this.trkMainLime.Maximum = 0xff;
            this.trkMainLime.Name = "trkMainLime";
            this.trkMainLime.Size = new Size(0x53, 0x13);
            this.trkMainLime.TabIndex = 14;
            this.txtMainLime.Dock = DockStyle.Right;
            this.txtMainLime.Location = new Point(0x68, 0);
            this.txtMainLime.MaxLength = 3;
            this.txtMainLime.Name = "txtMainLime";
            this.txtMainLime.Size = new Size(30, 0x15);
            this.txtMainLime.TabIndex = 13;
            this.picMainLime.BackColor = Color.Lime;
            this.picMainLime.Dock = DockStyle.Left;
            this.picMainLime.Location = new Point(0, 0);
            this.picMainLime.Name = "picMainLime";
            this.picMainLime.Size = new Size(0x15, 0x15);
            this.panMainRed.Controls.Add(this.trkMainRed);
            this.panMainRed.Controls.Add(this.txtMainRed);
            this.panMainRed.Controls.Add(this.picMainRed);
            this.panMainRed.Dock = DockStyle.Top;
            this.panMainRed.Location = new Point(0x3f, 0);
            this.panMainRed.Name = "panMainRed";
            this.panMainRed.Size = new Size(0x86, 0x15);
            this.trkMainRed.Dock = DockStyle.Top;
            this.trkMainRed.Location = new Point(0x15, 0);
            this.trkMainRed.Maximum = 0xff;
            this.trkMainRed.Name = "trkMainRed";
            this.trkMainRed.Size = new Size(0x53, 0x13);
            this.trkMainRed.TabIndex = 10;
            this.txtMainRed.Dock = DockStyle.Right;
            this.txtMainRed.Location = new Point(0x68, 0);
            this.txtMainRed.MaxLength = 3;
            this.txtMainRed.Name = "txtMainRed";
            this.txtMainRed.Size = new Size(30, 0x15);
            this.txtMainRed.TabIndex = 1;
            this.picMainRed.BackColor = Color.Red;
            this.picMainRed.Dock = DockStyle.Left;
            this.picMainRed.Location = new Point(0, 0);
            this.picMainRed.Name = "picMainRed";
            this.picMainRed.Size = new Size(0x15, 0x15);
            this.picMain.Dock = DockStyle.Left;
            this.picMain.Location = new Point(0, 0);
            this.picMain.Name = "picMain";
            this.picMain.Size = new Size(0x3f, 0x3f);
            base.set_AutoScaleDimensions(new SizeF(96f, 96f));
            base.set_AutoScaleMode(2);
            base.Controls.Add(this.panMain);
            base.Name = "StyleControl";
            base.Size = new Size(0xc5, 0xc5);
            this.panMain.ResumeLayout(false);
            this.panFull.ResumeLayout(false);
            this.panLine.ResumeLayout(false);
            this.panLineColor.ResumeLayout(false);
            this.panLineColorBlue.ResumeLayout(false);
            this.panLineColorLime.ResumeLayout(false);
            this.panLineColorRed.ResumeLayout(false);
            this.panTop.ResumeLayout(false);
            this.panMainBlue.ResumeLayout(false);
            this.panMainLime.ResumeLayout(false);
            this.panMainRed.ResumeLayout(false);
            base.ResumeLayout(false);
        }

        private void listColor_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.listColor.SelectedIndices.Count > 0)
            {
                switch (this.ControlStyle)
                {
                    case StyleType.PointStyle:
                        this.SetMainColor((Color) this.listColor.Items[this.listColor.SelectedIndices[0]].Tag);
                        return;

                    case StyleType.PolylineStyle:
                        this.SetLineColor((Color) this.listColor.Items[this.listColor.SelectedIndices[0]].Tag);
                        return;

                    case StyleType.PolygonStyle:
                        this.SetMainColor((Color) this.listColor.Items[this.listColor.SelectedIndices[0]].Tag);
                        return;

                    default:
                        return;
                }
            }
        }

        public void LoadDefault(IStyle Style)
        {
            this.ControlStyle = Style.Type;
            this.IniControl();
            switch (this.ControlStyle)
            {
                case StyleType.PointStyle:
                    this.SetStyle((IPointStyle) Style);
                    break;

                case StyleType.PolylineStyle:
                    this.SetStyle((IPolylineStyle) Style);
                    break;

                case StyleType.PolygonStyle:
                    this.SetStyle((IPolygonStyle) Style);
                    break;
            }
            this.RefreshList();
        }

        public void RefreshList()
        {
            this.img.Images.Clear();
            this.listColor.Items.Clear();
            for (int i = 0; i < 20; i++)
            {
                Color color = this.GetColor();
                ListViewItem item = new ListViewItem();
                item.Tag = color;
                item.Text = color.R.ToString() + "," + color.G.ToString() + "," + color.B.ToString();
                item.ImageIndex = this.img.Images.Count - 1;
                this.listColor.Items.Add(item);
            }
        }

        private void SetLineColor(Color color)
        {
            this.trkLineRed.Value = Convert.ToInt32(color.R.ToString());
            this.trkLineLime.Value = Convert.ToInt32(color.G.ToString());
            this.trkLineBlue.Value = Convert.ToInt32(color.B.ToString());
            this.txtLineRed.Text = color.R.ToString();
            this.txtLineLime.Text = color.G.ToString();
            this.txtLineBlue.Text = color.B.ToString();
            this.picLine.BackColor = color;
            this.picLine.Refresh();
        }

        private void SetMainColor(Color color)
        {
            this.trkMainRed.Value = Convert.ToInt32(color.R.ToString());
            this.trkMainLime.Value = Convert.ToInt32(color.G.ToString());
            this.trkMainBlue.Value = Convert.ToInt32(color.B.ToString());
            this.txtMainRed.Text = color.R.ToString();
            this.txtMainLime.Text = color.G.ToString();
            this.txtMainBlue.Text = color.B.ToString();
            this.picMain.BackColor = color;
            this.picMain.Refresh();
        }

        private void SetStyle(IPointStyle Style)
        {
        }

        private void SetStyle(IPolygonStyle Style)
        {
        }

        private void SetStyle(IPolylineStyle Style)
        {
        }

        private void setTrkEvent()
        {
            this.trkMainRed.ValueChanged += new EventHandler(this.TrkValue);
            this.trkMainLime.ValueChanged += new EventHandler(this.TrkValue);
            this.trkMainBlue.ValueChanged += new EventHandler(this.TrkValue);
            this.trkLineRed.ValueChanged += new EventHandler(this.TrkValue);
            this.trkLineLime.ValueChanged += new EventHandler(this.TrkValue);
            this.trkLineBlue.ValueChanged += new EventHandler(this.TrkValue);
        }

        private void setTxtEvent()
        {
            this.txtMainRed.TextChanged += new EventHandler(this.TxtChanged);
            this.txtMainLime.TextChanged += new EventHandler(this.TxtChanged);
            this.txtMainBlue.TextChanged += new EventHandler(this.TxtChanged);
            this.txtLineRed.TextChanged += new EventHandler(this.TxtChanged);
            this.txtLineLime.TextChanged += new EventHandler(this.TxtChanged);
            this.txtLineBlue.TextChanged += new EventHandler(this.TxtChanged);
            this.txtMainRed.KeyPress += new KeyPressEventHandler(this.TxtKeyPress);
            this.txtMainLime.KeyPress += new KeyPressEventHandler(this.TxtKeyPress);
            this.txtMainBlue.KeyPress += new KeyPressEventHandler(this.TxtKeyPress);
            this.txtLineRed.KeyPress += new KeyPressEventHandler(this.TxtKeyPress);
            this.txtLineLime.KeyPress += new KeyPressEventHandler(this.TxtKeyPress);
            this.txtLineBlue.KeyPress += new KeyPressEventHandler(this.TxtKeyPress);
        }

        private void TrkValue(object sender, EventArgs e)
        {
            TrackBar bar = (TrackBar) sender;
            switch (bar.Name)
            {
                case "trkMainRed":
                    this.txtMainRed.Text = bar.Value.ToString();
                    break;

                case "trkMainLime":
                    this.txtMainLime.Text = bar.Value.ToString();
                    break;

                case "trkMainBlue":
                    this.txtMainBlue.Text = bar.Value.ToString();
                    break;

                case "trkLineRed":
                    this.txtLineRed.Text = bar.Value.ToString();
                    break;

                case "trkLineLime":
                    this.txtLineLime.Text = bar.Value.ToString();
                    break;

                case "trkLineBlue":
                    this.txtLineBlue.Text = bar.Value.ToString();
                    break;
            }
            string text2 = bar.Name.Substring(0, 7).ToUpper();
            if (text2 != null)
            {
                if (text2 != "TRKMAIN")
                {
                    if (text2 != "TRKLINE")
                    {
                        return;
                    }
                }
                else
                {
                    this.picMain.BackColor = Color.FromArgb(this.trkMainRed.Value, this.trkMainLime.Value, this.trkMainBlue.Value);
                    this.picMain.Refresh();
                    return;
                }
                this.picLine.BackColor = Color.FromArgb(this.trkLineRed.Value, this.trkLineLime.Value, this.trkLineBlue.Value);
                this.picLine.Refresh();
            }
        }

        private void TxtChanged(object sender, EventArgs e)
        {
            TextBox box = (TextBox) sender;
            string name = box.Name;
            if (name != null)
            {
                if (name != "txtMainRed")
                {
                    if (name != "txtMainLime")
                    {
                        if (name == "txtMainBlue")
                        {
                            this.trkMainBlue.Value = int.Parse(box.Text);
                            return;
                        }
                        if (name == "txtLineRed")
                        {
                            this.trkLineRed.Value = int.Parse(box.Text);
                            return;
                        }
                        if (name == "txtLineLime")
                        {
                            this.trkLineLime.Value = int.Parse(box.Text);
                            return;
                        }
                        if (name == "txtLineBlue")
                        {
                            this.trkLineBlue.Value = int.Parse(box.Text);
                        }
                        return;
                    }
                }
                else
                {
                    this.trkMainRed.Value = int.Parse(box.Text);
                    return;
                }
                this.trkMainLime.Value = int.Parse(box.Text);
            }
        }

        private void TxtKeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsNumber(e.KeyChar) && (e.KeyChar != '\b'))
            {
                e.Handled = true;
            }
        }

        public IStyle GetStyle
        {
            get
            {
                switch (this.ControlStyle)
                {
                    case StyleType.PointStyle:
                        return this.ps;

                    case StyleType.PolylineStyle:
                    {
                        bool flag2 = this.cmbLineWidth.Text != "";
                        return this.pls;
                    }
                    case StyleType.PolygonStyle:
                    {
                        bool flag1 = this.cmbLineWidth.Text != "";
                        return this.pns;
                    }
                }
                return null;
            }
        }
    }
}

